package com.jintian.smart.kernel.core.orm;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 前端传递复合查询
 */
@Data
public class CombinedQuery implements ICondition, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private List<ICondition> musts = new ArrayList<>();

	private List<ICondition> mustsNot = new ArrayList<>();

	private List<ICondition> shoulds = new ArrayList<>();

	public CombinedQuery should(ICondition condition) {
		if (condition == null) {
			throw new IllegalArgumentException("inner condition clause cannot be null");
		}
		shoulds.add(condition);
		return this;
	}

	public CombinedQuery must(ICondition condition) {
		if (condition == null) {
			throw new IllegalArgumentException("inner condition clause cannot be null");
		}
		musts.add(condition);
		return this;
	}

	public CombinedQuery notMust(ICondition condition) {
		if (condition == null) {
			throw new IllegalArgumentException("inner condition clause cannot be null");
		}
		mustsNot.add(condition);
		return this;
	}

}
